<?php
//权限管理模块路由
Route::group(['namespace'=>'Access'],function(){
    //['namespace'=>'Access','middleware'=>'access.routeNeedsPermission:manage-users;xxxx,true']
    //Route::get()->middleware(['first', 'second']);
    //用户管理
    Route::get('userIndex', 'UserController@index')->name('admin.access.user.index')->middleware('access.routeNeedsPermission:user-index');
    Route::get('userSearch', 'UserController@search')->name('admin.access.user.search')->middleware('access.routeNeedsPermission:user-index');
    Route::any('userAdd', 'UserController@add')->name('admin.access.user.add')->middleware('access.routeNeedsPermission:user-add');
    Route::get('userRow', 'UserController@getRow')->name('admin.access.user.row')->middleware('access.routeNeedsPermission:user-index');
    Route::any('userUpdate', 'UserController@update')->name('admin.access.user.update')->middleware('access.routeNeedsPermission:user-update');
    Route::any('userDelete', 'UserController@delete')->name('admin.access.user.delete')->middleware('access.routeNeedsPermission:user-delete');
    Route::post('userActive', 'UserController@active')->name('admin.access.user.active')->middleware('access.routeNeedsPermission:user-restore');
    Route::get('userExt', 'UserController@getExt')->name('admin.access.user.ext')->middleware('access.routeNeedsPermission:user-index');
    Route::get('userAddress', 'UserController@getAddress')->name('admin.access.user.address')->middleware('access.routeNeedsPermission:user-index');
    Route::post('attachRelation', 'UserController@attachRelation')->name('admin.access.user.attach')->middleware('access.routeNeedsPermission:user-index');
    Route::post('detachRelation', 'UserController@detachRelation')->name('admin.access.user.detach')->middleware('access.routeNeedsPermission:user-index');
    //角色管理
    Route::get('roleIndex', 'RoleController@index')->name('admin.access.role.index')->middleware('access.routeNeedsPermission:role-index');
    Route::get('roleSearch', 'RoleController@search')->name('admin.access.role.search')->middleware('access.routeNeedsPermission:role-index');
    Route::any('roleAdd', 'RoleController@add')->name('admin.access.role.add')->middleware('access.routeNeedsPermission:role-add');
    Route::any('roleUpdate/id/{id?}', 'RoleController@update')->name('admin.access.role.update')->middleware('access.routeNeedsPermission:role-update');
    Route::any('roleDelete', 'RoleController@delete')->name('admin.access.role.delete')->middleware('access.routeNeedsPermission:role-delete');
    //节点管理
    Route::any('permissionIndex', 'PermissionController@index')->name('admin.access.permission.index')->middleware('access.routeNeedsPermission:permission-index');
    Route::get('permissionSearch', 'PermissionController@search')->name('admin.access.permission.search')->middleware('access.routeNeedsPermission:permission-index');
    Route::any('permissionAdd', 'PermissionController@add')->name('admin.access.permission.add')->middleware('access.routeNeedsPermission:permission-add');
    Route::any('permissionUpdate', 'PermissionController@update')->name('admin.access.permission.update')->middleware('access.routeNeedsPermission:permission-update');
    Route::any('permissionDelete', 'PermissionController@delete')->name('admin.access.permission.delete')->middleware('access.routeNeedsPermission:permission-delete');
    //getToken取消权限验证
    Route::get('permissionGetToken', 'PermissionController@getToken')->name('admin.access.permission.getToken');
    Route::get('permissionGetNode/{mode?}', 'PermissionController@getNode')->name('admin.access.permission.getNode');
});